from lib.ZNode import ZNode
from lib.res.config import win_size
from lib.res.fun import _create_image , _set_size , _create_image_alpha


class ZImage ( ZNode ) :
	def __init__ ( self , father , filename , size = win_size , alpha = False ) :
		super ( ZImage , self ).__init__ ( father )
		if not alpha :
			self.image = _create_image ( filename )
		else :
			self.image = _create_image_alpha ( filename )
		self.image = _set_size ( self.image , size )
		self._size = size

	def draw ( self ) :
		if self._running :
			self.father.screen.blit ( self.image , self._pos )

	@property
	def _size ( self ) :
		return self.rect.size

	@_size.getter
	def _size ( self ) :
		return self.rect.size

	@_size.setter
	def _size ( self , size ) :
		self.rect.size = size
